<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Vue:局部组件注册</title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<style>

		</style>
		<script type='text/template' id='tmp'>
			<div>
				<h2>{{title}}</h2>
				<ul>
					<li>第一件事</li>
					<li>第二件事</li>
				</ul>
			</div>
		</script>
	</head>
	<body>
		<div id="app1">
			<my-header></my-header>
		</div>
		<div id="app2">
			<my-header></my-header>
		</div>
		<div id="app3">
			<my-header></my-header>
		</div>
		<script type="text/javascript">
			Vue.component('my-header', {
				data:function(){
					return {
						title: 'Hello VUE'
					}
				},
				template: '<h2>{{title}}</h2>'
			})
			
			new Vue({
				el: '#app1'
			});
			new Vue({
				el: '#app2'
			});
			new Vue({
				el: '#app3',
				components:{
					'my-header': {
						data:function(){
							return {
								title: 'Hello VUE2'
							}
						},
						template: '#tmp'
					}
				}
			});
		</script>
	</body>
</html>
